      INTEGER          FUNCTION IZAMAX( N, ZX, INCX )
*
*     finds the index of element having max. absolute value.
*     jack dongarra, 3/11/78.
*
*     .. Scalar Arguments ..
      INTEGER                           INCX, N
*     ..
*     .. Array Arguments ..
      COMPLEX*16                        ZX( 1 )
*     ..
*     .. Local Scalars ..
      INTEGER                           I, IX
      DOUBLE PRECISION                  SMAX
*     ..
*     .. External Functions ..
      DOUBLE PRECISION                  DCABS1
      EXTERNAL                          DCABS1
*     ..
*     .. Executable Statements ..
*
      IZAMAX = 1
      IF( N.LE.1 )
     $   RETURN
      IF( INCX.EQ.1 )
     $   GO TO 30
*
*        code for increment not equal to 1
*
      IX = 1
      IF( INCX.LT.0 )
     $   IX = 1 - ( N-1 )*INCX
      SMAX = DCABS1( ZX( IX ) )
      IX = IX + INCX
      DO 20 I = 2, N
         IF( DCABS1( ZX( IX ) ).LE.SMAX )
     $      GO TO 10
         IZAMAX = I
         SMAX = DCABS1( ZX( IX ) )
   10    IX = IX + INCX
   20 CONTINUE
      IF( INCX.LT.0 )
     $   IZAMAX = N - IZAMAX + 1
      RETURN
*
*        code for increment equal to 1
*
   30 SMAX = DCABS1( ZX( 1 ) )
      DO 40 I = 2, N
         IF( DCABS1( ZX( I ) ).LE.SMAX )
     $      GO TO 40
         IZAMAX = I
         SMAX = DCABS1( ZX( I ) )
   40 CONTINUE
      RETURN
      END
